
<?php
/**
 * Registration Form
 * This form would allow users of the system register with the system
 * 
 */

 class Account_Form_editProfile extends Zend_Dojo_Form
 {
	public function __construct($options = null)
		{
		parent::__construct($options);
		Zend_Dojo::enableForm($this);
		$this->setName('Edit Profile');
    
    	//Last Name --Dojo
	
		
		//User Enters email address
		$emailaddress = new Zend_Dojo_Form_Element_ValidationTextBox('email');
		$emailaddress->setLabel('Email: ')
					 ->setRequired(true)
					 ->addFilter('StripTags')
					 ->addFilter('StringTrim')
					 ->setpromptMessage('Please enter your email address')
					 ->addValidator('EmailAddress')
					 ->addValidator('NotEmpty');
					
					 
		/**
		 * User Account details
		 */
		$userName = new Zend_Dojo_Form_Element_ValidationTextBox('username');
		$userName->setLabel('UserName: ')
					 ->setRequired(true)
					 ->addFilter('StripTags')
					 ->addFilter('StringTrim')
					 ->setpromptMessage('Please enter you username')
					 ->addValidator('NotEmpty');
		
		$password = new Zend_Dojo_Form_Element_PasswordTextBox('password');
		$password->setLabel('Password: ')
					 ->setRequired(true)
					 ->setpromptMessage('Please change your password from the default setting')
					 ->addValidator('NotEmpty');	
		
			

		//Select school
		
$school = new Zend_Dojo_Form_Element_FilteringSelect('school');
$school->setLabel('Select school');
		$schooler = new Admin_Model_DbTable_School();
	   $list = $schooler->fetchAll();
	
		foreach($list as $l){
	  $school->addMultiOption($l->id, $l->name);
	}

$school->setAutocomplete(true);
		   
		$submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
		$submit->setLabel('Edit Your Account');
		
		$this->addElements(array($emailaddress,$school, $userName, $password) );
	    $this->addElement($submit);
	    
		//$this->setAction('register');
$userName->removeDecorator('Label');
$userName->addDecorator('Label');
$userName->removeDecorator('HtmlTag');
$userName->addDecorator('HtmlTag', array('tag' => 'p'));

//Password styling

$password->removeDecorator('Label');
$password->addDecorator('Label');
$password->removeDecorator('HtmlTag');
$password->addDecorator('HtmlTag', array('tag' => 'p'));

//Email styling
$emailaddress->removeDecorator('Label');
$emailaddress->addDecorator('Label');
$emailaddress->removeDecorator('HtmlTag');
$emailaddress->addDecorator('HtmlTag', array('tag' => 'p'));

//School styling
$school->removeDecorator('Label');
$school->addDecorator('Label');
$school->removeDecorator('HtmlTag');
$school->addDecorator('HtmlTag', array('tag' => 'p'));

//Removing dl tag to be replaced by a fieldset
$this->setDecorators(array(
          'FormElements',
          array('HtmlTag', array('tag' => 'fieldset')),
          'Form'
      ));
 
		$this->setMethod('POST');
		}
}
 
